﻿using System.Windows.Forms;
using SharpDND.Core.Entity;
using SharpDND.Core.Entity.Common;

namespace SharpDNDTools.Forms.Core
{
    public partial class frmAddEditAlignment : Form
    {
        private readonly Alignment _alignment;

        public frmAddEditAlignment(Alignment alignment)
        {
            InitializeComponent();
            _alignment = alignment;

            txtName.Text = _alignment.AlignmentType;
            txtDescription.Text = _alignment.Description;
        }

        private void toolBar1_ButtonClick(object sender, ToolBarButtonClickEventArgs e)
        {
            if (e.Button == tbbSave)
            {
                _alignment.AlignmentType = txtName.Text;
                _alignment.Description = txtDescription.Text;

                _alignment.Save();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
    }
}